#### SENSITIVITY TEST: Bivariate regression table ####
mod_ced_bivariate <- lm(formula(paste(dv_ced, "~", iv_last_algorithm)),
                        data = ced)

cedr2 <- get_r2(mod_ced_bivariate)
mod_ced_bivariate <- get_clusters(mod_ced_bivariate)

mod_primary_bivariate <- lm(formula(paste(dv_prim, "~", iv_last_algorithm)),
                            data = primary)

primaryr2 <- get_r2(mod_primary_bivariate)
mod_primary_bivariate <- get_clusters(mod_primary_bivariate)

mod_general_bivariate <- lm(formula(paste(dv_gen, "~", iv_last_algorithm)),
                            data = general)

generalr2 <- get_r2(mod_general_bivariate)
mod_general_bivariate <- get_clusters(mod_general_bivariate)

stargazer(mod_general_bivariate, mod_primary_bivariate, mod_ced_bivariate,
          type = "latex",
          title = "Bivariate Relationship Between Surname Fluency and Vote Share",
          style = "ajps",
          ci = F,
          model.names = F,
          star.cutoffs = star.cutoffs,
          star.char = star.char,
          notes = notes,
          keep = "last_algorithm",
          covariate.labels = "Surname Pronounceability",
          add.lines=list(c("Year FE", "\\checkmark", "\\checkmark", "\\checkmark"),
                         c("State FE", "\\checkmark", "\\checkmark", "X"),
                         c("County FE", "X", "X", "\\checkmark"),
                         c("N", get_n(mod_general_bivariate), get_n(mod_primary_bivariate), get_n(mod_ced_bivariate)),
                         c("Adj. R-squared", generalr2, primaryr2, cedr2)),
          align = F,
          column.labels = column.labels,
          keep.stat = c("n", "adj.rsq"),
          out = "tables/reg-bivariate.tex",
          label = "tab:bivariate")


